#include "device.h"
#include "isr.h"

int t, time = 0;
extern int16 motor_pwm;
extern device_t device;
void TIM2_IRQHandler(void)   
{
	if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) // 检查指定的TIM中断发生与否:TIM 中断源 
	{
		TIM_ClearITPendingBit(TIM2, TIM_IT_Update);  // 清除TIMx的中断待处理位:TIM 中断源 
        
        device.mpu6050.get_raw_data();
        
        t++;
        if (t == device.para.timer_frequency)
        {
            ++time;
            t = 0;
        }
        if (time == 100) time = 0;
        check_data_loss_time(1,5);
	}
}


